package com.monster.datasourcejob.typeconverter.fieldtype;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;

/**
 * description:
 *
 * @author Yuanml on 2021/6/29 15:45
 */
public enum MysqlType {
    DECIMAL("DECIMAL"),
    DECIMAL_UNSIGNED("DECIMAL UNSIGNED"),
    TINYINT("TINYINT"),
    TINYINT_UNSIGNED("TINYINT UNSIGNED"),
    BOOLEAN("BOOLEAN"),
    SMALLINT("SMALLINT"),
    SMALLINT_UNSIGNED("SMALLINT UNSIGNED"),
    INT("INT"),
    INT_UNSIGNED("INT UNSIGNED"),
    FLOAT("FLOAT"),
    FLOAT_UNSIGNED("FLOAT UNSIGNED"),
    DOUBLE("DOUBLE"),
    DOUBLE_UNSIGNED("DOUBLE UNSIGNED"),
    NULL("NULL"),
    TIMESTAMP("TIMESTAMP"),
    BIGINT("BIGINT"),
    BIGINT_UNSIGNED("BIGINT UNSIGNED"),
    MEDIUMINT("MEDIUMINT"),
    MEDIUMINT_UNSIGNED("MEDIUMINT UNSIGNED"),
    DATE("DATE"),
    TIME("TIME"),
    DATETIME("DATETIME"),
    YEAR("YEAR"),
    VARCHAR("VARCHAR"),
    VARBINARY("VARBINARY"),
    BIT("BIT"),
    JSON("JSON"),
    ENUM("ENUM"),
    SET("SET"),
    TINYBLOB("TINYBLOB"),
    TINYTEXT("TINYTEXT"),
    MEDIUMBLOB("MEDIUMBLOB"),
    MEDIUMTEXT("MEDIUMTEXT"),
    LONGBLOB("LONGBLOB"),
    LONGTEXT("LONGTEXT"),
    BLOB("BLOB"),
    TEXT("TEXT"),
    CHAR("CHAR"),
    BINARY("BINARY"),
    GEOMETRY("GEOMETRY"),
    UNKNOWN("UNKNOWN");
    private final String typeName;

    MysqlType(String typeName) {
        this.typeName = typeName;
    }
    public String getTypeName() {
        return typeName;
    }

    public static MysqlType getByTypeName(String typeName) {
        typeName = typeName.toUpperCase();
        return MysqlType.valueOf(typeName);
    }
}
